
import SelectSubCompany from '@/components/Select/SelectSubCompany'
import SelectProject from '@/components/Select/SelectProject'
import QuarterPicker from './quarterPicker.vue'
import OrgTreeSelect from '@/components/OrgTreeSelect'
import moment from 'moment'
import Vue from 'vue'
/**
 * 考核分数
 * 60分以下、60-69、70-79、80-89、90-100
 */
const gradeList = [
    {
        value: '0,60',
        label: '60分以下'
    },
    {
        value: '60,69',
        label: '60-69'
    },
    {
        value: '70,79',
        label: '70-79'
    },
    {
        value: '80,89',
        label: '80-89'
    },
    {
        value: '90,100',
        label: '90-100'
    },
]

/**
 * 状态
 * 待提交、已提交、未考核
 */
const statusList = [
  {
      value: '0',
      label: '待提交'
  },
  {
      value: '1',
      label: '已提交'
  },
  {
      value: '2',
      label: '未考核'
  },
]

/**
 * 状态
 * 状态0待提交1已提交2审核中3未考核4审核不通过5审核通过
 */
const statusList2 = [
  {
      value: '0',
      label: '待提交'
  },
  {
      value: '1',
      label: '已提交'
  },
  {
      value: '2',
      label: '审核中'
  },
  {
      value: '3',
      label: '未考核'
  },
  {
      value: '4',
      label: '审核不通过'
  },
  {
      value: '5',
      label: '审核通过'
  },
]

/**
 * 完成效果
 * 已完成、未完成
 */
const effectStatus = [
  {
      value: '已完成',
      label: '已完成'
  },
  {
      value: '未完成',
      label: '未完成'
  },
]

// 搜索条件
const searchOption = [
  {
    name: '所属单位',
    valueKey: 'searchQuery',
    type: OrgTreeSelect,
  },
    // {
    //     name: '分公司',
    //     valueKey: 'branchComId',
    //     type: SelectSubCompany,
    //     autoSelected: Vue.getAcloudProvider().getUserInfo().currentPost.code !== 'CO',
    // },
    {
        name: '考核时间',
        valueKey: 'startEndDate',// start - end
        type: QuarterPicker,
        setInitValue: true,
        initValue: [],
    },
    {
        name: '考核分数',
        value: 'grade', // start - end
        type: 'select',
        data: gradeList
    },
]

// 定义表头
const columns = [
    {
        title: '序号',
        width: 65,
        scopedSlots: { customRender: 'serial' },
    },
    {
        title: '分公司',
        width: 100,
        dataIndex: 'branchComName',
    },
    {
        title: '考核时间',
        width: 100,
        dataIndex: 'examineYearQuarter',
        // scopedSlots: { customRender: 'examineYearMonth' },
    },
    {
        title: '季度分数',
        dataIndex: 'grade',
        width: 100,
        customRender(text, record, index) {
          return (text === '' || text === undefined || text === null) ? '-' : text
        }
    },
    {
        title: '操作',
        dataIndex: 'action',
        width: 180,
        fixed: 'right',
        scopedSlots: { customRender: 'action' },
    },
]

const testData = [
  {
    id: '1',
    branchComName: '四川分公司',
    examineYearMonth: '2021年第三季度',
    grade: 89,
    state: '0',
    stateName: '待提交',
  },
  {
    id: '2',
    branchComName: '重庆分公司',
    examineYearMonth: '2021年第三季度',
    overtime: true,
    grade: 89,
    state: '1',
    stateName: '已提交',
  },
  {
    id: '3',
    branchComName: '中南分公司',
    examineYearMonth: '2021年第三季度',
    grade: 89,
    state: '2',
    stateName: '审核中',
  },
  {
    id: '4',
    branchComName: '中南分公司',
    examineYearMonth: '2021年第三季度',
    grade: 89,
    state: '3',
    stateName: '未考核',
  },
  {
    id: '5',
    branchComName: '中南分公司',
    examineYearMonth: '2021年第三季度',
    grade: 89,
    state: '4',
    stateName: '审核不通过',
  },
  {
    id: '6',
    branchComName: '中南分公司',
    examineYearMonth: '2021年第三季度',
    grade: 89,
    state: '5',
    stateName: '审核通过',
  }
]

const detailColums = [
    {
        title: '序号',
        width: 65,
        scopedSlots: { customRender: 'serial' },
    },
    {
        title: '项目名称',
        width: '240px',
        dataIndex: 'projectName',
    },
    // 0重要工期节点控制（40分）1施工部署、总平面布置及资源配置（20分）2分包进场（15分）3分供采购（15分）4重大技术方案（10分
    {
        title: '重要工期节点控制（40分）',
        dataIndex: 'nodeControl',
    },
    {
        title: '施工部署、总平面布置及资源配置（20分）',
        dataIndex: 'resourceConfig',
    },
    {
        title: '分包进场（15分）',
        dataIndex: 'approach',
    },
    {
        title: '分供采购（15分）',
        dataIndex: 'purchase',
    },
    {
        title: '重大技术方案（10分）',
        dataIndex: 'technicalScheme',
    },
    {
        title: '季度分数',
        dataIndex: 'grade',
    },
]

export {
  gradeList,
  statusList2,
  effectStatus,
  searchOption,
  columns,
  testData,
  detailColums
}